Skip to content

Conversation

@Integral-Tech
Copy link
Contributor

@Integral-Tech Integral-Tech commented Jun 9, 2025

Replace XWayland with Wayland in Wayland sessions.

Thanks to @mtwebster for the patch.

Closes: #387

@mtwebster
Copy link
Member

Hi, please refactor due to 98af104

Thanks!

@SnaetWarre
Copy link

can we get this to prod?

@mtwebster
Copy link
Member

#460 was merged, which makes this stuff a bit cleaner, maybe we can add WAYLAND_DISPLAY to copy_env() instead?

@Integral-Tech
Copy link
Contributor Author

#460 was merged, which makes this stuff a bit cleaner, maybe we can add WAYLAND_DISPLAY to copy_env() instead?

Sorry for my late reply.
WAYLAND_DISPLAY need to be set to $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY, otherwise Timeshift may fail to launch:

> pkexec env WAYLAND_DISPLAY="$WAYLAND_DISPLAY" XDG_RUNTIME_DIR=/run/user/0 timeshift-gtk
(timeshift-gtk:240870): Gtk-WARNING **: 22:33:53.550: cannot open display:

However, we can add GTK_THEME to copy_env() to ensure the theme remains consistent with other GTK apps.

@mtwebster
Copy link
Member

Can you try this out? I'd rather keep it all here. This works ok for me in Mint 22. I get a native Wayland window. Update your PR if you want and I'll merge it.

diff --git a/src/Core/Main.vala b/src/Core/Main.vala
index bf7a629..5954af8 100644
--- a/src/Core/Main.vala
+++ b/src/Core/Main.vala
@@ -378,13 +378,22 @@ public class Main : GLib.Object{
                }
 
                // copy all required enviroment vars from the user to this process
-               string[] targets = {"DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS"};
+               string[] targets = {"GTK_THEME", "DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS"};
                foreach (string target in targets) {
                        string user_var = TeeJee.ProcessHelper.get_env(user_env, target);
                        if(user_var != null) {
                                GLib.Environment.set_variable(target, user_var, true);
                        }
                }
+
+        string xdg_runtime_dir = TeeJee.ProcessHelper.get_env(user_env, "XDG_RUNTIME_DIR");
+        string wayland_display = TeeJee.ProcessHelper.get_env(user_env, "WAYLAND_DISPLAY");
+
+        if (wayland_display != null && xdg_runtime_dir != null) {
+            string path = "%s/%s".printf(xdg_runtime_dir, wayland_display);
+            GLib.Environment.set_variable("WAYLAND_DISPLAY", path, true);
+            GLib.Environment.set_variable("XDG_RUNTIME_DIR", "/run/user/0", true);
+        }
        }
 
     private int[]? get_btrfs_version_array () {

@Integral-Tech
Copy link
Contributor Author

@mtwebster A native Wayland window is displayed after reverting my previous changes and applying your patch. However, the following log appears in the terminal:

/usr/bin/timeshift-launcher: line 16: xhost: command not found
/usr/bin/timeshift-launcher: line 18: xhost: command not found
/usr/bin/timeshift-launcher: line 19: xhost: command not found

IMO we should remove the usage of xhost in the launcher script timeshift-launcher.

Replace XWayland with Wayland in Wayland sessions.

Thanks to @mtwebster for the patch.

Closes: #387
@Integral-Tech
Copy link
Contributor Author

@mtwebster I have just pushed a new commit that includes your patch and removes the usage of xhost in timeshift-launcher :)

@mtwebster mtwebster merged commit 331d568 into linuxmint:master Nov 27, 2025
2 checks passed
@Integral-Tech Integral-Tech deleted the fix-xwayland branch November 27, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Fix the wayland backend?

3 participants